package net.streaming.client;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class HandleFileImpl implements Handle{
	private String path;

	public HandleFileImpl() {
	}

	public HandleFileImpl(String path) {
		this.path = path;
	}

	public void handle(byte[] msg){
		OutputStream out = null;
		try{
			out = new FileOutputStream(path, true);
			out.write(msg);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if(out!=null){
				try {
					out.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}
	
}
